package org.feiye.studyday28;

import java.io.*;
import java.net.*;
import java.util.Scanner;

public class TalkClient {

	public static void main(String[] args) {
		Scanner inin = new Scanner(System.in);
		System.out.println("我说：");
		String ss = inin.nextLine();
		Socket socket = null;
		try {
			socket = new Socket("192.168.10.93", 6666);
			InputStream in = socket.getInputStream();
			OutputStream out = socket.getOutputStream();
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String reply = br.readLine();
			System.out.println("服务器说：" + reply);
			PrintWriter p = new PrintWriter(out);
			p.println(ss);
			p.flush();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (socket != null)
				try {
					socket.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}

}
